package com.wxapp.admin.service.controller;

import com.wxapp.admin.api.pojo.vo.roleMenu.QAddRoleMenuPerssionVo;
import com.wxapp.admin.api.pojo.vo.roleMenu.QRoleSaveVo;
import com.wxapp.admin.service.service.RoleMenuService;
import com.wxapp.common.constant.base.IBaseController;
import com.wxapp.common.constant.pojo.vm.ResultVm;
import com.wxapp.common.constant.pojo.vo.UserVo;
import com.wxapp.common.core.annotation.User;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lgl
 * @Description 权限
 * @Datetime 2022/6/6 9:13
 * @Modified By
 */
@RestController
@RequestMapping("role/menu")
@Tag(name = "权限管理")
@RequiredArgsConstructor
public class RoleMenuController extends IBaseController {
   private final RoleMenuService roleMenuService;

    @PostMapping("/inside/add")
    @Operation(summary ="添加权限/内部接口")
    public ResultVm<String> addMeanPerssion(@RequestBody QAddRoleMenuPerssionVo QAddRoleMenuPerssionVo) {
        return roleMenuService.addMeanPerssion(QAddRoleMenuPerssionVo);
    }

    @PostMapping("/add")
    @Operation(summary ="添加权限/外部接口")
    public ResultVm<String> addPerssion(@Schema(hidden = true) @User UserVo userVo, @RequestBody QRoleSaveVo qRoleSaveVo) {
        return roleMenuService.addPerssion(userVo, qRoleSaveVo);
    }
}
